---
title: clsAffiliatedPolicyCollection
summary: API reference for clsAffiliatedPolicyCollection.
status: draft
owner: SAIF Corporation
last_reviewed: 2026-08-21
library: SAIF.Business.View.Policy
reference_type: embedded
---

# clsAffiliatedPolicyCollection

`clsAffiliatedPolicyCollection` is the legacy affiliated-policy list for a policy. It calls `pk72846_view_policy.getpolicyaffiliatelist`, materializes each row as `clsAffiliatedPolicy`, filters the result by requesting agent or agency when those criteria are present, and supplies the obsolete affiliate view that `clsPolicyData` still uses for compatibility alongside the newer association model.

## Purpose
- Retrieve affiliated-policy rows from `pk72846_view_policy.getpolicyaffiliatelist` for the requested policy and affiliate type.
- Filter the returned list by agent or agency context, supporting the behavior summarized in [BR-VP-012](../../business-rules.md#br-vp-012-affiliated-policy-list-filtered-by-agentagency).
- Provide the legacy affiliate list whose display and inclusion behavior is governed by [BR-VP-011](../../business-rules.md#br-vp-011-policy-always-affiliated-with-itself) and [BR-VP-013](../../business-rules.md#br-vp-013-displayaffiliatedpolices-matrix-controls-display).

## Context
- Namespace: `SAIF.Business.View.Policy`
- Assembly/package: `SAIF.Business.View.Policy` (embedded)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `Item` | `Default Public ReadOnly Property Item(ByVal Index As Integer) As clsAffiliatedPolicy` | Returns the affiliated-policy row at a specific collection position. |
| `Item` | `Default Public ReadOnly Property Item(ByVal inPolicyKey As String) As clsAffiliatedPolicy` | Returns the affiliated-policy row identified by its policy key. |
| `CurrentItem` | `Public Shadows ReadOnly Property CurrentItem() As clsAffiliatedPolicy` | Returns the currently selected affiliated-policy row. |
| `MyCriteria` | `Public ReadOnly Property MyCriteria() As Criteria` | Exposes the retrieval and filtering criteria used to build the collection. |
| `Contains` | `Public Overloads Function Contains(ByVal inAffiliatedPolicy As clsAffiliatedPolicy) As Boolean` | Reports whether an equivalent affiliated-policy row is already present. |
| `Contains` | `Public Overloads Function Contains(ByVal inPolicyKey As String) As Boolean` | Reports whether a row with the supplied policy key is present. |
| `SetCurrent` | `Public Overloads Sub SetCurrent(ByVal inPolicyNum As String)` | Moves the collection's current selection to the row whose key matches the supplied policy number string. |
| `GetAffiliatedPolicyCollection` | `Public Shared Function GetAffiliatedPolicyCollection(ByVal inDataportal As IDataPortalInfo, ByVal inPolicyNum As Decimal, ByVal inAffiliateType As clsPolicyData.AffiliateTypes) As clsAffiliatedPolicyCollection` | Retrieves the legacy affiliate list for a policy and affiliate type. |
| `GetAffiliatedPolicyCollection` | `Public Shared Function GetAffiliatedPolicyCollection(ByVal inCriteria As Criteria) As clsAffiliatedPolicyCollection` | Retrieves or creates the collection directly from a fully prepared criteria object. |
| `PreferredAssociationType` | `Public Property PreferredAssociationType() As AssociationTypes` | Carries the preferred association type that child `clsAffiliatedPolicy.Policy` objects propagate into the full `clsPolicyData` they lazily load. |
| `PolicyNum` | `Public Property PolicyNum() As Decimal` | Stores the source policy number used to retrieve affiliated rows. |
| `RetrieveSQL` | `Friend ReadOnly Property RetrieveSQL() As String` | Names the stored procedure used to fetch affiliated-policy rows. |

## Behavioral notes
- `BeforeRetrieve` sends `in_policy_num`, `in_affiliate_type`, and `in_include_affil_totals` to `pk72846_view_policy.getpolicyaffiliatelist`, then `AfterRetrieve` materializes each reader row as `clsAffiliatedPolicy`.
- `AfterRetrieve` adds all rows when no agent/agency filter is provided, otherwise keeps only rows whose agent number or agency sequence matches the criteria, implementing the filtering described by [BR-VP-012](../../business-rules.md#br-vp-012-affiliated-policy-list-filtered-by-agentagency).
- The collection sets its current item to the source policy after retrieval, aligning with the broader legacy-affiliate behavior that a policy is always affiliated with itself under [BR-VP-011](../../business-rules.md#br-vp-011-policy-always-affiliated-with-itself).* 
- When `AffiliateType` is `NonAffiliated`, `GetAffiliatedPolicyCollection(Criteria)` creates an empty collection rather than running the retrieval procedure, which supports the display gating summarized by [BR-VP-013](../../business-rules.md#br-vp-013-displayaffiliatedpolices-matrix-controls-display).* 

## Constraints and usage notes
- This is legacy compatibility API; analysis states consumers should prefer the newer associations model when possible.
- Inherited members are omitted because `clsBusinessCollectionBase` is external.
- Create/insert/update/delete criteria throw `InvalidSQLProperty`, consistent with [BR-VP-027](../../business-rules.md#br-vp-027-createinsertupdatedelete-sql-are-invalid).

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `SAIF.Business.View.Policy/clsAffiliatedPolicyCollection.vb`
- `SAIF.Business.View.Policy/clsAffiliatedPolicy.vb`
- `SAIF.Business.View.Policy/clsPolicyData.vb`
